<h5>资产转移</h5>
<div class="content">
  <form #deliverForm="ngForm">
    <div class="assetusemsg">
      <div class="form-group  w-50">
        <label class="mr-2"><span class="red">*</span>转移后使用部门</label>
        <select required class="form-control mr-2" type="text" (ngModelChange)="changeDepartment($event)" [(ngModel)]="deliver.new_departmentid" name="new_departmentid">
          <option *ngFor="let department of departments" [value]="department.id">
            {{department.departName}}
          </option>
        </select>
        <span class="cursor" (click)="addDepartment()">新增</span>
        <div class="red" *ngIf="messages.new_departmentid">{{ messages.new_departmentid }}</div>
      </div>
      <div class="form-group  w-50">
        <label class="mr-2"><span class="red">*</span>转移后使用人</label>
        <select required class="form-control mr-2" type="text"  [(ngModel)]="deliver.new_userid" name="new_userid" (ngModelChange)="changeUser($event)" >
          <option>请选择</option>
          <option *ngFor="let user of users" [value]="user.id">
            {{user.realName}}
          </option>
        </select>
        <span class="cursor" (click)="addPerson()">新增</span>
        <div class="red" *ngIf="messages.new_userid">{{ messages.new_userid }}</div>
      </div>
      <div class="form-group  w-50">
        <label class="mr-2"><span class="red">*</span>转移后座位号</label>
        <input required class="form-control mr-2" type="text"  placeholder="请输入转移后座位号" [(ngModel)]="deliver.address" name="address" readonly>
        <div class="red" *ngIf="messages.address">{{ messages.address }}</div>
      </div>

      <div class="form-group  w-50">
        <label class="mr-2">转移时间</label>
        <input class="form-control mr-2" matInput [matDatepicker]="deliverpicker" placeholder="选择日期" [value]="deliver.deliverDateShow?.value"
               (dateChange)="onSelectdeliverDate($event)">
        <mat-datepicker-toggle matSuffix [for]="deliverpicker"></mat-datepicker-toggle>
        <mat-datepicker  #deliverpicker></mat-datepicker>
      </div>

      <div class="form-group  w-50">
        <label class="mr-2">处理人</label>
        <input class="form-control mr-2" type="text" [(ngModel)]="deliver.deliverUser.realName" name="realName"  readonly>
      </div>
    </div>
    <div class="w-100">
      <label>资产备注</label>
      <div class="form-group">
        <textarea class="form-control" style="width: 93%;resize: none" [(ngModel)]="deliver.remark" name="remark"></textarea>
      </div>
    </div>
    <label>选择要转移的资产</label>
    <span class="cursor float-right mr-3"  (click)="appearSearchbox()">高级搜索</span>
    <div class="grid">
      <table mat-table [dataSource]="assets | paginate: {itemsPerPage: pageSize, currentPage: page, totalItems: total}"  [trackBy]="trackById" class="table-hover table-bordered w-100">
        <ng-container matColumnDef="select">
          <th mat-header-cell *matHeaderCellDef>
            <mat-checkbox (change)="$event? allToggle() : null"
                          [checked]="selection.hasValue() && isAllSelected()"
                          [indeterminate]="selection.hasValue() && !isAllSelected()"
            >
            </mat-checkbox>
          </th>
          <td mat-cell *matCellDef="let row">
            <mat-checkbox (change)="$event ? itemChanged(row,$event): null"
                          (click)="$event.stopPropagation()"
                          [checked]="selection.isSelected(row)">
            </mat-checkbox>
          </td>
        </ng-container>

        <ng-container matColumnDef="assetCode">
          <th mat-header-cell *matHeaderCellDef>资产编码</th>
          <td mat-cell *matCellDef="let row">{{ row.assetCode}}</td>
        </ng-container>

        <ng-container matColumnDef="assetName">
          <th mat-header-cell *matHeaderCellDef>资产名称</th>
          <td class="overWords" mat-cell *matCellDef="let row ">{{ row.assetName }}</td>
        </ng-container>

        <ng-container matColumnDef="assetType">
          <th mat-header-cell *matHeaderCellDef>资产类别</th>
          <td mat-cell *matCellDef="let row">{{ row.oaAssetType?.GDZCLBMC }}</td>
        </ng-container>

        <ng-container matColumnDef="assetDate">
          <th mat-header-cell *matHeaderCellDef>入库时间</th>
          <td mat-cell *matCellDef="let row">{{ row.buyDate | date: 'yyyy-MM-dd' }}</td>
        </ng-container>

        <ng-container matColumnDef="departName">
          <th mat-header-cell *matHeaderCellDef>现使用部门</th>
          <td class="overWords" mat-cell *matCellDef="let row ">{{ row.sysDepartment.departName }}</td>
        </ng-container>

        <ng-container matColumnDef="username">
          <th mat-header-cell *matHeaderCellDef>现使用人</th>
          <td class="overWords" mat-cell *matCellDef="let row ">{{ row.sysUser.realName}}</td>
        </ng-container>

        <!--对应列名List.ts中定义-->
        <tr mat-header-row *matHeaderRowDef="cols"></tr>
        <tr mat-row *matRowDef="let data; columns: cols"></tr>
      </table>
    </div>
    <span class="float-right mr-3" style="color: grey;font-size: 10px;margin-top: 5px">共{{total}}条</span>
    <app-pagination
      (pageChange)="onPageChanged($event)"
      [maxSize]="9"
      [isShowInput]="false"
      [isMiniMode]="false"
      [isShowPage]="false"
      [total]="total"
    >
    </app-pagination>
  </form>
</div>
<div class="buttons text-center">
  <button class="btn btn-outline-primary mr-2" type="button" (click)="onSubmit()">保存</button>
  <button class="btn btn-outline-secondary" type="button" [mat-dialog-close] cdkFocusInitial>取消</button>
</div>
<div *ngIf="appearSearch" class="superBox">
  <div class="modalContent">
    <label>分字段搜索</label>
    <div class="assetusemsg">
      <div class="form-group w-50">
        <label class="mr-2 w-25">资产编码</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="资产编码" [(ngModel)]="asset.assetCode" name="assetCode">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">资产名称</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="资产名称" [(ngModel)]="asset.assetName" name="assetName">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">资产型号</label>
        <input class="form-control mr-2  w-60" type="text"  placeholder="型号" [(ngModel)]="asset.assetVersion" name="assetVersion">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">渠道</label>
        <input class="form-control mr-2 w-60" type="text"  placeholder="渠道" [(ngModel)]="asset.sourceComefrom" name="sourceComefrom">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">品牌</label>
        <input class="form-control mr-2 w-60" type="text" placeholder="品牌" [(ngModel)]="asset.assetBrand" name="assetBrand">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">座位号</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="使用位置" [(ngModel)]="asset.position" name="position">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">SN号</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="请输入SN号" [(ngModel)]="asset.snNum" name="snNum">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">发票号码</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="发票号码" [(ngModel)]="asset.invoiceNum" name="invoiceNum">
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">备注信息</label>
        <input required class="form-control mr-2 w-60" type="text"  placeholder="备注信息" [(ngModel)]="asset.remark" name="remark">
      </div>
    </div>
    <div class="mt-2 mb-2 boundary"></div>
    <label>条件筛选</label>
    <div class="assetusemsg">
      <div class="form-group w-50 dropdown">
        <label class="mr-2 w-25">资产类别</label>
        <input autocomplete="off" required class="form-control mr-2 w-60" type="text"  placeholder="输入资产类别"  [(ngModel)]="assettypeName" (click)="showtypeTree()" name="assettypeName">
        <tree-root class="treemenu" *ngIf="typetree" [nodes]="nodes" [options]="options" tabindex=100 (blur)="hidetree()"></tree-root>
      </div>
      <div class="form-group  w-50">
        <label class="mr-2 w-25">资产来源</label>
        <select required class="form-control mr-2 w-60" type="text" [(ngModel)]="asset.source" name="assetsource">
          <option [value]="0">自购</option>
          <option [value]="1">租赁</option>
          <option [value]="2">借用</option>
          <option [value]="3">其他</option>
          <option [value]="4">自产</option>
          <option [value]="5">赠送</option>
        </select>
      </div>
      <div class="form-group  w-50">
        <label class="mr-2 w-25">使用部门</label>
        <select required class="form-control mr-2 w-60" type="text" [(ngModel)]="asset.sysDepartment.id" name="departmentid" (ngModelChange)="changeDepartment($event)">
          <option *ngFor="let department of departments" [value]="department.id">
            {{department.departName}}
          </option>
        </select>
      </div>
      <div class="form-group  w-50">
        <label class="mr-2 w-25">使用人</label>
        <select  class="form-control mr-2" type="text"  [(ngModel)]="asset.sysUser.id" name="userid">
          <option *ngFor="let user of users" [value]="user.id">
            {{user.realName}}
          </option>
        </select>
      </div>
      <div class="form-group w-50">
        <label class="mr-2 w-25">资产状态</label>
        <input  class="form-control mr-2 w-60" type="text"  placeholder="使用中"  readonly>
      </div>
      <div class="form-group w-100">
        <label class="mr-3" style="width: 10% !important;;">入库日期</label>
        <input style="width: 38%" class="form-control" type="text"  (click)="beginDate.open()" [max]="endCtrl.value" (ngModelChange)="onSwitchDate($event)" [formControl]="beginCtrl" placeholder="选择开始日期" [matDatepicker]="beginDate" readonly>
        <mat-datepicker #beginDate></mat-datepicker>
        -
        <input style="width: 37%" class="form-control" type="text"  (click)="endDate.open()" [min]="beginCtrl.value" (ngModelChange)="onSwitchDate($event)" [formControl]="endCtrl" placeholder="选择截止日期" [matDatepicker]="endDate" readonly>
        <mat-datepicker #endDate></mat-datepicker>
      </div>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-primary" (click)="bigsearch()">搜索</button>
      <button type="button" class="btn btn-secondary" (click)="reset()">重置</button>
      <button type="button" class="btn btn-danger"  (click)="closesearch()">关闭</button>
    </div>
  </div>
</div>
